package vsm.vsm_server.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vsm.vsm_server.pojo.Result.Result;
import vsm.vsm_server.pojo.SearchDto;
import vsm.vsm_server.pojo.User.UserInfo;
import vsm.vsm_server.pojo.Video.VideoNailVO;
import vsm.vsm_server.service.SearchService;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/search")
@CrossOrigin
public class SearchController {
    @Autowired
    SearchService searchService;

    @PostMapping("/user/{keyword}")
    public Result<List<UserInfo>> searchUser(@PathVariable String keyword){
        List<UserInfo> userInfoList =  searchService.searchUser(keyword);
        return Result.success(userInfoList);
    }

    @PostMapping("/video/{keyword}")
    public Result<List<VideoNailVO>> searchVideo(@PathVariable String keyword){
        List<VideoNailVO> videoNailVOList = searchService.searchVideo(keyword);
        return Result.success(videoNailVOList);
    }

}
